#pragma once

#include "Enumeration.h"

#include "EnumerationLiteral.h"

namespace uml {

Enumeration::Enumeration(const QString& umlType)
    : DataType(umlType) {}

void Enumeration::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    DataType::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(ownedLiterals_, "ownedLiterals", json, errorList);
}

void Enumeration::toJson(QJsonObject& json) {
    DataType::toJson(json);
    JsonSerializable::toJsonArray(ownedLiterals_, "ownedLiterals", json);
}

/// <summary>
/// ownedLiterals getter
/// The ordered set of literals owned by this Enumeration.
/// </summary>
vector<shared_ptr<EnumerationLiteral>>& Enumeration::ownedLiterals() {
    return ownedLiterals_;
}

} // namespace uml
